// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import axios from 'axios'
window.axios = axios
axios.defaults.baseURL = 'http://weoffice.yindd.cn'
//  axios.defaults.baseURL = 'http://wxofficedev.yindd.cn'
  
// axios.defaults.baseURL = 'http://wxofficeuat.yindd.cn'

// import util from './util/util.js'
Vue.prototype.$axios = axios
// Vue.prototype.$util = util
window.WeAlert = weui.alert
window.WeConfirm = weui.confirm

// import   '../static/weui.css'
// 饿了么ui
import MintUI from 'mint-ui'
Vue.use(MintUI)
import 'mint-ui/lib/style.css'

// vuex
import bus from './bus/bus.js'
Vue.prototype.$bus = bus
Vue.prototype.$global = {}


var VueTouch = require('vue-touch')
Vue.use(VueTouch, {
  name: 'v-touch'
})
// var VueTouch = require('vue-touch')
VueTouch.config.swipe = {
  direction: 'horizontal'
};
// Vue.use(VueTouch, {
//   name: 'v-touch'
// })

// import vueTouch from 'vue-touch'
// Vue.use(vueTouch)
// vue filter
Vue.filter('timeFormat', function (time) {
  // return time.toString().split('T')[0]
  if (time) {
    let year = time.getFullYear()
    let month = time.getMonth() + 1
    let day = time.getDate()
    return `${year}-${month}-${day}`
  }
})
Vue.filter('timeFormat1', function (time) {
  let day = time.toString().split('T')[0]
  let hour = time.toString().split('T')[1].slice(0, 5)
  return `${day}  ${hour}`

})
Vue.filter('JobType', function (item) {
  switch (item) {
    case 1:
      return '打印'
      break;
    case 2:
      return '复印'
      break;
    case 3:
      return '扫描'
      break;
    case 3:
      return '传值'
      break;
    case 0:
      return '未知类型'
      break;
  }
})
Vue.filter('DocumentStatus', function (item) {
  switch (item) {
    case 0:
      return '全部'
      break;
    case 3:
      return '待取件'
      break;
    case 9:
      return '已取件'
      break;
  }
})
Vue.filter('DocumentType', function (item) {
  switch (item) {
    case 0:
      return 'other'
      break;
    case 1:
      return 'pdf'
      break;
    case 2:
      return 'xps'
      break;
    case 3:
      return 'other'
      break;
    case 4:
      return 'word'
      break;
    case 5:
      return 'txt'
      break;
    case 6:
      return 'img'
      break;
    default:
      return 'other'
  }
})

// 全局组件
import SubTitle from './components/common/title/title.vue'
Vue.component('SubTitle', SubTitle)

Vue.directive('title', {
  inserted: function (el, binding) {
    document.title = binding.value
  }
})



Vue.prototype.$url = 'http://weoffice.yindd.cn'
// Vue.prototype.$url  = 'http://wxofficedev.yindd.cn'
// Vue.prototype.$url = `http://wxofficeuat.yindd.cn`

Vue.config.productionTip = false

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  template: '<App/>',
  components: {
    App
  }
})
